import React, { Component } from 'react'
import { Redirect, Route, Switch } from 'react-router-dom'
import Footer from './components/Footer'
import Index from './components/Index'
import Desc from './components/pages/Desc'
import Document from './components/pages/Document'
import Note from './components/pages/Note'
import ToTop from './components/plugin/ToTop'
import Section from './components/Section'
import Nav from './components/plugin/Nav'
import Add from './components/pages/Add'

export default class App extends Component {
  state = {title:'首页'}
  setTile = (t)=>{
    console.log(t)
  }
  render() {
    return (
      <div>
        <Index />
        <section className="w-all">
            <Nav title = {this.state.title} />
          <Switch>
            <Route path="/main" component={Section} />
            <Route exact={true} path="/document" component={Document} />
            <Route exact={true} path="/document/item" component={Desc} />
            <Route path="/note" component={Note} />
            <Route path="/add" component={Add} />
            <Redirect to="/main" />
          </Switch>
        </section>
        {/* <Add /> */}
        <Footer />
        <ToTop />

      </div>
    )
  }
}
